<template>
	<view>
		<u-navbar placeholder fixed autoBack border title="工人信息采集"></u-navbar>
		<view class="d-p-30">
			<view class="d-font-24 d-flex d-row-center" style="color: #ADB4BD;">
				<u--image src="/static/icon/icon-55.png" width="30rpx" height="30rpx"></u--image>
				<text class="d-m-l-10">请将采集信息输入下方框中</text>
			</view>

			<view class="d-font-32 d-m-t-30" style="font-weight: bold;color: #151C24;">人员进场信息</view>
			<view class="d-m-t-10">
				<view class="d-flex u-border-bottom" style="height: 80rpx;">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						班组名称
					</view>
					<view class="d-flex-1"><u--input border="none" v-model="form.bzmc" inputAlign="right" placeholder="请输入" disabled disabledColor="#fff"></u--input></view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view class="d-flex u-border-bottom" style="height: 80rpx;">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						是否班组长
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.sfzz_label" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.gwlx = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						角色
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.gwlx_label" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.zwzc = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						从事工种
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.zwzc_label" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>

				<!-- <view class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.sflwht = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						是否签订合同
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.sflwht_label" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view :hidden="form.sflwht != 1" class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.htlx = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						合同类型
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.htlx_label" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view :hidden="form.sflwht != 1" class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.htqdsj = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						合同签订时间
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.htqdsj_time" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view :hidden="form.sflwht != 1" class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.htqssj = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						合同起始时间
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.htqssj_time" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view :hidden="form.sflwht != 1" class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.htzzsj = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						合同终止时间
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.htzzsj_time" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view :hidden="form.sflwht != 1" class="d-flex u-border-bottom" style="height: 80rpx;">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						合同编号
					</view>
					<view class="d-flex-1"><u--input border="none" v-model="form.lwhtbh" inputAlign="right" placeholder="请输入"></u--input></view>
				</view>
				<view :hidden="form.sflwht != 1" class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.gzjsfs = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						工资计算方式
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.gzjsfs_label" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view :hidden="form.sflwht != 1" class="d-flex u-border-bottom" style="height: 80rpx;">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						工资标准
					</view>
					<view class="d-flex-1"><u--input border="none" v-model="form.gzbz" inputAlign="right" placeholder="请输入"></u--input></view>
				</view>
				<view :hidden="form.sflwht != 1" class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.gzzfrq = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						工资支付日
					</view>
					<view class="d-flex-1"><u--input border="none" v-model="form.gzzfrq" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input></view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.gzklb = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						工资卡类别
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.gzklb_label" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view :hidden="form.gzklb != 2" class="d-flex u-border-bottom" style="height: 80rpx;" @click="show.khhyh = true">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						工资卡开卡银行
					</view>
					<view class="d-flex-1">
						<u--input border="none" v-model="form.khhyh_label" inputAlign="right" placeholder="请选择" disabled disabledColor="#fff"></u--input>
					</view>
					<u-icon name="arrow-down" color="#8E9291" size="28rpx"></u-icon>
				</view>
				<view :hidden="form.gzklb != 2" class="d-flex u-border-bottom" style="height: 80rpx;">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						开户行行号
					</view>
					<view class="d-flex-1"><u--input border="none" v-model="form.khhdm" inputAlign="right" placeholder="请输入"></u--input></view>
				</view>
				<view :hidden="form.gzklb != 2" class="d-flex u-border-bottom" style="height: 80rpx;">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						工资卡号
					</view>
					<view class="d-flex-1"><u--input border="none" v-model="form.gzkkh" inputAlign="right" placeholder="请输入"></u--input></view>
				</view>
				<view :hidden="form.gzklb != 1" class="d-flex u-border-bottom" style="height: 80rpx;">
					<view class="d-font-28 d-m-r-30" style="color: #5D6672;">
						<text style="color: red;">*</text>
						社保卡号
					</view>
					<view class="d-flex-1"><u--input border="none" v-model="form.sbkkh" type="number" inputAlign="right" placeholder="请输入"></u--input></view>
				</view> -->
			</view>
			<view class="d-p-80">
				<view class="d-flex d-row-center">
					<view style="width: 450rpx;"><u-button text="上一步" shape="circle" type="info" @click="back"></u-button></view>
				</view>
				<view class="d-flex d-row-center d-m-t-30">
					<view style="width: 450rpx;"><u-button :text="form.id ? '保存' : '提交采集'" shape="circle" type="primary" @click="submit"></u-button></view>
				</view>
			</view>
		</view>

		<u-picker
			v-for="(item, index) in dict"
			:key="index"
			:show="show[index]"
			closeOnClickOverlay
			:columns="[dict[index]]"
			keyName="name"
			@close="show[index] = false"
			@cancel="show[index] = false"
			@confirm="setPicker($event, index)"
		></u-picker>

		<!-- <u-datetime-picker
			v-for="(item, index) in datePick"
			:key="index"
			:show="show[item]"
			mode="date"
			closeOnClickOverlay
			@close="show[item] = false"
			@cancel="show[item] = false"
			@confirm="setDate($event, item)"
			v-model="form[item]"
		></u-datetime-picker> -->

		<u-picker
			:show="showBanzhu"
			closeOnClickOverlay
			:columns="[banzhu]"
			keyName="bzmc"
			@close="showBanzhu = false"
			@cancel="showBanzhu = false"
			@confirm="setBanzhu"
		></u-picker>

		<!-- <u-picker
			closeOnClickOverlay
			:columns="[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 226, 27, 28, 29, 30]]"
			:show="show.gzzfrq"
			@close="show.gzzfrq = false"
			@cancel="show.gzzfrq = false"
			@confirm="setGzzfrq"
		></u-picker> -->
	</view>
</template>

<script>
import { getDict, groups, ryxxSmrz, upload, putRyxxSmrz } from '../../../common/api.js';
export default {
	data() {
		return {
			form: {
				bzmc: '', // 班组名称：bzmc（根据下拉班组列表获取）【必填】
				bzid: '', // 班组编号：bzid（根据下拉班组列表获取）【必填】
				sfzz: 0, // 是否班组长【字典：shifou】：sfzz（默认值：否）【必填】
				gwlx: 1025, // 角色【字典：role】：gwlx（默认值：一般作业人员，字典值只获取：1025 ；1026）【必填】
				zwzc: '', // 从事工种【字典：worktype】：zwzc(
				// 1、角色=1025时，字典值：['2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '13', '16', '32', '64', '128', '129', '130', '131', '132' , '133', '134', '135', '136', '137', '138', '139', '142', '143', '144', '145']
				// 2、角色=1026时，字典值：['140', '141', '146', '147', '148', '149', '151', '152', '153', '154', '155'])【必填】

				// sflwht: 1, // 是否签订合同：sflwht[字典：shifou]（默认：是）[必填]
				// htlx: '', // 合同类型：htlx[字典：htlx]（根据“是否签订合同”字段控制，选择“是”时显示且[必填]）
				// htqdsj: '', // 合同签订时间：htqdsj（默认当前日期，根据“是否签订合同”字段控制，选择“是”时显示且[必填]）
				// htqssj: '', // 合同起始时间：htqssj（默认当前日期，根据“是否签订合同”字段控制，选择“是”时显示且[必填]）
				// htzzsj: '', // 合同终止时间：htzzsj（根据“是否签订合同”字段控制，选择“是”时显示且[必填]）
				// lwhtbh: '', // 合同编号：lwhtbh（根据“是否签订合同”字段控制，选择“是”时显示且[必填]）
				// gzjsfs: 1, // 工资计算方式：gzjsfs[字典：jxfs]（默认：按月，根据“是否签订合同”字段控制，选择“是”时显示且[必填]）
				// gzbz: '', // 工资标准：gzbz（根据“是否签订合同”字段控制，选择“是”时显示且[必填]）
				// gzzfrq: '', // 工资支付日：gzzfrq（根据“是否签订合同”字段控制，选择“是”时显示且[必填]）

				// gzklb: 2, // 工资卡类别：gzklb[字典：gzklb]（默认：银行卡）[必填]
				// khhyh: '', // 工资卡开卡银行：khhyh[字典：jyjgbm]（根据“工资卡类别”字段控制，选择“银行卡”时显示且[必填]）
				// khhdm: '', // 开户行行号：khhdm(根据工资卡开卡银行字典值进行赋值=remark字典)（根据“工资卡类别”字段控制，选择“银行卡”时显示且[必填]）
				// gzkkh: '', // 工资卡号：gzkkh（根据“工资卡类别”字段控制，选择“银行卡”时显示且[必填]）

				// sbkkh: '', // 社保卡号：sbkkh（根据“工资卡类别”字段控制，选择“社保卡”时显示且[必填]）
				createRyid: '', // 增加用户的人员编号：createRyid（根据用户获得添加人员编号）【必填】
				createUser: '' // 创建人(用户账号+'['+用户昵称+']')：createUser（acc+'['+userName+']'）;//【必填】
			},
			dict: {
				sfzz: [],
				gwlx: [],
				zwzc: [],
				sflwht: [],
				htlx: [],
				gzjsfs: [],
				gzklb: [],
				khhyh: []
			},
			options: {
				worktype: ['zwzc'],
				role: ['gwlx'],
				shifou: ['sfzz'],
				// shifou: ['sfzz', 'sflwht'],
				// htlx: ['htlx'],
				// jxfs: ['gzjsfs'],
				// gzklb: ['gzklb'],
				// jyjgbm: ['khhyh']
			},
			show: {
				sfzz: false,
				gwlx: false,
				zwzc: false,
				// sflwht: false,
				// htlx: false,
				// htqdsj: false,
				// htqssj: false,
				// htzzsj: false,
				// gzjsfs: false,
				// gzklb: false,
				// khhyh: false,

				// gzzfrq: false
			},
			// datePick: ['htqdsj', 'htqssj', 'htzzsj'],
			banzhu: [],
			showBanzhu: false,
			worktype: [],
			isChange: false
		};
	},
	watch: {
		'form.gwlx': function(e) {
			this.initZwzc(e);
		}
	},
	onLoad() {
		let options = this.options;
		groups({
			params: {
				pageNum: 1,
				pageSize: 1000,
				gcbh: this.$user.ssgcxx[this.$appIndex].gcbh
			}
		}).then(e => {
			this.banzhu = e.data;
			this.isVery();
		});
		for (let i in options) {
			getDict({
				name: i
			}).then(e => {
				for (let j in options[i]) {
					if (i == 'role') {
						let arr = [];
						for (let i in e.data) {
							if (e.data[i].dictValue == 1025 || e.data[i].dictValue == 1026) {
								arr.push(e.data[i]);
							}
						}
						this.dict[options[i][j]] = arr.map(item => {
							return { value: item.dictValue, name: item.dictLabel };
						});
					} else if (i == 'worktype') {
						// 联动 特殊处理
						this.worktype = e.data.map(item => {
							return { value: item.dictValue, name: item.dictLabel };
						});
					} else if (i == 'jyjgbm') {
						this.dict.khhyh = e.data.map(item => {
							return { value: item.dictValue, name: item.dictLabel, remark: item.remark };
						});
					} else {
						this.dict[options[i][j]] = e.data.map(item => {
							return { value: item.dictValue, name: item.dictLabel };
						});
					}
				}

				this.isVery();
			});
		}
	},
	onShow() {
		let form = uni.getStorageSync('store_form') || {};
		this.form = uni.$u.deepMerge(this.form, form);
		this.form.bzmc = this.$user.ssgcxx[this.$appIndex].bzmc;
		this.form.bzid = this.$user.ssgcxx[this.$appIndex].bzid;
		this.form.bzbh = this.$user.ssgcxx[this.$appIndex].bzid;
		this.isVery();
	},
	methods: {
		initZwzc(e) {
			let arr = [];
			if (e == 1025) {
				arr = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 16, 32, 64, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 142, 143, 144, 145];
			} else if (e == 1026) {
				arr = [140, 141, 146, 147, 148, 149, 151, 152, 153, 154, 155];
			}
			if (e) {
				let zwzc = [];
				for (let i in this.worktype) {
					if (arr.indexOf(Number(this.worktype[i].value)) > -1) {
						zwzc.push(this.worktype[i]);
					}
				}
				this.dict.zwzc = zwzc;
				// 重置默认值
				// this.form['zwzc'] = this.dict['zwzc'][0] ? this.dict['zwzc'][0].value : '';
				// this.form['zwzc' + '_label'] = this.dict['zwzc'][0] ? this.dict['zwzc'][0].name : '';
				if (this.isChange) {
					this.form['zwzc'] = '';
					this.form['zwzc' + '_label'] = '';
					this.isChange = false;
				}
			}
		},
		isVery() {
			for (let i in this.datePick) {
				if (!this.form[this.datePick[i]]) {
					// 不默认
					if ('htzzsj' != this.datePick[i]) {
						this.form[this.datePick[i]] = this.$moment().format('YYYY-MM-DD');
						this.form[this.datePick[i] + '_time'] = this.$moment().format('YYYY-MM-DD');
					}
				} else {
					this.form[this.datePick[i]] = this.$moment(this.form[this.datePick[i]]).format('YYYY-MM-DD');
					this.form[this.datePick[i] + '_time'] = this.form[this.datePick[i]];
				}
			}
			let field = this.show;
			let arr = [];
			for (let i in field) {
				arr.push(i);
			}
			for (let i in arr) {
				if (this.form[arr[i]] !== '') {
					if (arr[i] == 'zwzc' && this.dict[arr[i]].length <= 0) {
						for (let j in this.worktype) {
							if (this.worktype[j].value == this.form[arr[i]]) {
								this.form[arr[i] + '_label'] = this.worktype[j].name;
								break;
							}
						}
					} else {
						// 反向渲染
						for (let j in this.dict[arr[i]]) {
							if (this.dict[arr[i]][j].value == this.form[arr[i]]) {
								this.form[arr[i] + '_label'] = this.dict[arr[i]][j].name;
								break;
							}
						}
					}
				}
			}
			// 初始化工种
			this.initZwzc(this.form.gwlx);
		},
		back() {
			uni.$u.route({
				type: 'back'
			});
		},
		setPicker(e, name) {
			this.show[name] = false;
			if (name == 'sfzz') {
				if (e.value[0].value == 1 && this.$user.ssgcxx[this.$appIndex].ssbzzxm) {
					return uni.$u.toast('当前班组已有班组长');
				}
			}
			this.form[name] = e.value[0].value;
			this.form[name + '_label'] = e.value[0].name;

			if (name == 'khhyh') {
				this.form.khhdm = e.value[0].remark;
			}
			if (name == 'gwlx') {
				// 需要手动变更
				this.isChange = true;
			}
		},
		setBanzhu(e) {
			this.showBanzhu = false;
			this.form.bzmc = e.value[0].bzmc;
			this.form.bzid = e.value[0].id;
			this.form.bzbh = e.value[0].id;
		},
		setDate(e, name) {
			this.show[name] = false;
			this.form[name] = this.$moment(e.value).format('YYYY-MM-DD');
			this.form[name + '_time'] = this.$moment(e.value).format('YYYY-MM-DD');
		},
		// setGzzfrq(e) {
		// 	this.form.gzzfrq = e.value[0];
		// 	this.show.gzzfrq = false;
		// },
		submit() {
			if (!this.form.zwzc) {
				return uni.$u.toast('请选择从事工种');
			}
			// if (this.form.sflwht == 1) {
			// 	if (!this.form.htlx) {
			// 		return uni.$u.toast('请选择合同类型');
			// 	}
			// 	if (!this.form.htqdsj) {
			// 		return uni.$u.toast('请选择合同签订时间');
			// 	}
			// 	if (!this.form.htqssj) {
			// 		return uni.$u.toast('请选择合同起始时间');
			// 	}
			// 	if (!this.form.htzzsj) {
			// 		return uni.$u.toast('请选择合同终止时间');
			// 	}
			// 	if (!this.form.lwhtbh) {
			// 		return uni.$u.toast('请输入合同编号');
			// 	}
			// 	if (this.form.gzjsfs === '') {
			// 		return uni.$u.toast('请选择工资计算方式');
			// 	}
			// 	if (!this.form.gzbz) {
			// 		return uni.$u.toast('请输入工资标准');
			// 	}
			// 	if (!this.form.gzzfrq) {
			// 		return uni.$u.toast('请选择工资支付日');
			// 	}
			// }
			// if (this.form.gzklb == 2) {
			// 	if (!this.form.khhyh) {
			// 		return uni.$u.toast('请选择工资卡开卡银行');
			// 	}
			// 	if (!this.form.khhdm) {
			// 		return uni.$u.toast('请输入开户行行号');
			// 	}
			// 	if (!this.form.gzkkh) {
			// 		return uni.$u.toast('请输入工资卡号');
			// 	}
			// } else if (this.form.gzklb == 1) {
			// 	if (!this.form.sbkkh) {
			// 		return uni.$u.toast('请输入社保卡号');
			// 	}
			// }
			uni.showLoading({
				title: '提交中...',
				mask: true
			});
			if (this.form.id) {
				let params = uni.$u.deepMerge(this.form, {
					createRyid: this.$user.ssrybh,
					createUser: this.$user.acc + '[' + this.$user.userName + ']',
					yxksrq: this.form.yxksrq.replace('.', '-').replace('.', '-'),
					yxjsrq: this.form.yxjsrq.replace('.', '-').replace('.', '-')
				});
				putRyxxSmrz({
					...params
				}).then(e => {
					uni.hideLoading();
					if (e.code == 200) {
						uni.$u.toast('已保存成功');
						setTimeout(() => {
							uni.$u.route({
								type: 'back',
								delta: 4
							});
						}, 1000);
					} else {
						console.error('保存失败', e);
						return uni.$u.toast(e.msg);
					}
				});
			} else {
				let params = uni.$u.deepMerge(this.form, {
					createRyid: this.$user.ssrybh,
					createUser: this.$user.acc + '[' + this.$user.userName + ']',
					yxksrq: this.form.yxksrq.replace('.', '-').replace('.', '-'),
					yxjsrq: this.form.yxjsrq.replace('.', '-').replace('.', '-')
				});

				ryxxSmrz({
					...params
				}).then(e => {
					console.log(e);
					if (e.code == 200) {
						// 提交上传后才删除
						if (process.env.NODE_ENV !== 'development') {
							uni.removeStorageSync('store_form');
						}
						upload({
							filePath: uni.getStorageSync('idCard'),
							name: 'file',
							formData: {
								ywlx: 'salary_smzgl_ryxx_smrz',
								attachType: 'sfz', // ryjz
								bid: e.ryxx.id
							}
						})
							.then(rep => {
								return upload({
									filePath: uni.getStorageSync('idCardFan'),
									name: 'file',
									formData: {
										ywlx: 'salary_smzgl_ryxx_smrz',
										attachType: 'sfz', // ryjz
										bid: e.ryxx.id
									}
								});
							})
							.then(rep => {
								return upload({
									filePath: uni.getStorageSync('auth_photo_url'),
									name: 'file',
									formData: {
										ywlx: 'salary_smzgl_ryxx_smrz',
										attachType: 'ryjz', // ryjz
										bid: e.ryxx.id
									}
								});
							})
							.then(e => {
								if (process.env.NODE_ENV !== 'development') {
									uni.removeStorageSync('idCardBase64Fan');
									uni.removeStorageSync('idCardBase64');
									uni.removeStorageSync('auth_photo');
									uni.removeStorageSync('idCard');
									uni.removeStorageSync('idCardFan');
									uni.removeStorageSync('auth_photo_url');
								}
								uni.hideLoading();
								uni.$u.toast('提交成功');
								setTimeout(() => {
									uni.$u.route({
										type: 'back',
										delta: 4
									});
								}, 1000);
							})
							.then(() => {
								uni.hideLoading();
							});
					} else {
						uni.hideLoading();
						console.error('提交失败', e);
						return uni.$u.toast(e.msg);
					}
				});
			}
		}
	}
};
</script>

<style lang="scss"></style>
